var stdin = process.stdin;

/**
 * stdin继承了EventEmitter
 * 继承了stream.Readable
 */

stdin.on("data", function(chunk){
    var chunk = chunk.toString("utf8");
    var result = chunk.slice(0, -2);
    if(result == ""){
        stdin.emit("end");
    }
    // console.log(chunk);
});

stdin.on("end", function(){
    console.log("stdin ended");
})